<?php

import ('com.yamvc.view.Mediator');

class MenuMediator extends Mediator {
	private $_items = array();
		
	public function __construct(ITemplate $template){
		parent::__construct($template);
		$this->addItem("Home",new MenuEvent(MenuEvent::ITEM_CLICK,array("DefaultAction")));
		$this->addItem("Downloads",new MenuEvent(MenuEvent::ITEM_CLICK,array("Downloads")));
		$this->addItem("Blog",new MenuEvent(MenuEvent::ITEM_CLICK,array("Blog")));
		//$this->addEventListener(MenuEvent::ITEM_CLICK,new EventListener($this,"itemClickHandler"));
	}
	
	public function addItem($name,MenuEvent $event){
		$item = array("label"=>$name,"url"=>"./?event=".$event);
		array_push($this->_items,$item);
		$this->_template-> putVariable("items",$this->_items);
	}
		
}

?>